<template>
  <div>
    <h1>登录</h1>
    用户名：<input type="text" v-model="userObj.name"><br>
    用户密码：<input type="text" v-model="userObj.pwd"><br>
    <input type="button" value="登录" @click="login()">
    <input type="button" value="重置">
  </div>
</template>

<script>
import axios from 'axios'

export default {
  data() {
    return {
      userObj: {},
    }
  },
  methods: {
    login() {
      axios.get("/project/user/login", {params: this.userObj}).then(resp => {
        if (resp.data == "ok") {
          this.$router.push({name: "Channel", query: this.userObj});
        } else {
          alert("登录失败");
        }
      })
    },
  }
}

</script>

<style scoped>

</style>